<%--
    Document   : ubahStatus
    Created on : Nov 22, 2011, 8:49:21 PM
    Author     : renaldo malau
--%>

<%@page import="javax.swing.JOptionPane"%>
<%@page import="databaseConnection.DatabaseConnection"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@include file="login_validasi.jsp" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body bgcolor="black">
        <table border="1">
            <tr>
                <td colspan="6" > 
                    <img src="images hotel/894_1_1000 bbg central hotel Bangkok 1.jpg" height="140" width="1350">
            <marquee style="font-family:Broadway BT;color:blue;font-size:20px">WELCOME TO HOTEL ADMF WEBSITE</marquee>
        </td>
            </tr>
            <tr>
                 <td align="justify" valign="top" bgcolor="#69F">

        <img src="images hotel/menu header.jpg" height="65" width="270" align="middle">
        <table border="1" style="background: #CF9" align="center" width="270">
                        <tr><td><a href="resepsionis.jsp"><input type="button" value="Resepsionis"/></a></td></tr>
                        <tr><td> <a href="lihat&UpdateTamu.jsp"><input type="button" value="lihat & update data tamu"/></a></td></tr>
                        <tr><td> <a href="ubahStatus.jsp" ><input type="button" value="Ubah status"/></a></td></tr>
                        <tr><td> <a href="logout.jsp"><input type="button" value="Logout"/></a></td></tr>
                    </table><br>
        <table border="1">
            <tr>
                <td colspan="2" align="center"><b>Arti Warna Jadwal Gedunng/Restoran</b></td>
            </tr>
            <tr>
                <td bgcolor="#6F6">_________</td>
                <td>Ruang kosong/tidak dipakai</td>
            </tr>
            <tr>
                <td bgcolor="#FE5A23">_________</td>
                <td>Ruang sedang berisi/dipesan</td>
            </tr>
            <tr>
                <td bgcolor="#999">_________</td>
                <td>Database Error</td>
            </tr>
        </table>
    </td>
    <td width="80%" height="70%" bgcolor="white">


                    
        <%!
        public String bgcolor(String data){
                        if(data.equalsIgnoreCase("kosong"))
                            return "#6F6";
                        else if(data.equalsIgnoreCase("ada"))
                            return "#FE5A23";
                        else return "#999";
                    }
                %>
        
        <% 
                    DatabaseConnection conn = new DatabaseConnection();
                    java.sql.Statement statement=conn.connection.createStatement();

               %>
        
        
        <center><b><h1 style="background-color:#69F">Ubah Status Gedung<HR></h1></b></center>
        <h3>bulan sekarang</h3>
        
 
                    <table border="1">
                        <%
                    java.sql.ResultSet resultGedung= statement.executeQuery("select * from jadwalpemakaiangedung"); 
                    String[] dataGedung=new String[31];
                    String[] dataGedung2=new String[31];
                    int j=0;
                    while(resultGedung.next()){
                        dataGedung[j]=resultGedung.getString("bulan1");
                        dataGedung2[j]=resultGedung.getString("bulan2");
                        j++;
                    }
                    
                        int i=1;
                        while(i<32){
                            %><tr><%
                            int k=1;
                            while(k>=1 &&k<=7){
                                %>
                            
                                <td bgcolor="<%=bgcolor(dataGedung[i-1])%>"><%=i%><br>ubah status<br>
                             <a href="dataRuang.jsp?ruang=gedung&tgl=<%=i%>&bln=bulan1&act=kosong"><input type="button" value="Kosong"/></a>
                             <a href="dataRuang.jsp?ruang=gedung&tgl=<%=i%>&bln=bulan1&act=ada"><input type="button" value="pesan"/></a>
                         </td>
                                
                                <%
                                i++;
                                k++;
                                if(i>31)
                                    break;
                            }
                            %><tr><%
                        }
                        %>
                    </table><br>
                    
                    
                    
                    <h3>bulan selanjutnya</h3>
                 <table border="1">
                        <%
                        
                        i=1;
                        while(i<32){
                            %><tr><%
                            int k=1;
                            while(k>=1 &&k<=7){
                                %>
                            
                             <td bgcolor="<%=bgcolor(dataGedung2[i-1])%>"><%=i%><br>ubah status<br>
                             <a href="dataRuang.jsp?ruang=gedung&tgl=<%=i%>&bln=bulan2&act=kosong"><input type="button" value="Kosong"/></a>
                             <a href="dataRuang.jsp?ruang=gedung&tgl=<%=i%>&bln=bulan2&act=ada"><input type="button" value="pesan"/></a>
                             </td>
                                
                                <%
                                i++;
                                k++;
                                if(i>31)
                                    break;
                            }
                            %><tr><%
                        }
                        %>
                    </table>  <br>
                    
                    
                    
                    <center><b><h1 style="background-color:#69F">Ubah Status Restoran<hr></h1></b></center>
        <h3>bulan sekarang</h3>
 
                    <table border="1">
                        <%
                        String[] dataRestoran=new String[31];
                        String[] dataRestoran2=new String[31];
                        java.sql.ResultSet resultRestoran= statement.executeQuery("select * from jadwalpemakaianrestoran");
                        j=0;
                        while(resultRestoran.next()){
                            dataRestoran[j]=resultRestoran.getString("bulan1");
                            dataRestoran2[j]=resultRestoran.getString("bulan2");
                            j++;
                        }
     
                        i=1;
                        while(i<32){
                            %><tr><%
                            int k=1;
                            while(k>=1 &&k<=7){
                                %>
                            
                                <td bgcolor="<%=bgcolor(dataRestoran[i-1])%>"><%=i%><br>ubah status<br>
                             <a href="dataRuang.jsp?ruang=restoran&tgl=<%=i%>&bln=bulan1&act=kosong"><input type="button" value="Kosong"/></a>
                             <a href="dataRuang.jsp?ruang=restoran&tgl=<%=i%>&bln=bulan1&act=ada"><input type="button" value="pesan"/></a>
                         </td>
                                
                                <%
                                i++;
                                k++;
                                if(i>31)
                                    break;
                            }
                            %><tr><%
                        }
                        %>
                    </table><br>
                    
                    
                    
                    <h3>bulan selanjutnya</h3>
                 <table border="1">
                        <%
                        i=1;
                        while(i<32){
                            %><tr><%
                            int k=1;
                            while(k>=1 &&k<=7){
                                %>
                            
                                <td bgcolor="<%=bgcolor(dataRestoran2[i-1])%>"><%=i%><br>ubah status<br>
                             <a href="dataRuang.jsp?ruang=restoran&tgl=<%=i%>&bln=bulan2&act=kosong"><input type="button" value="Kosong"/></a>
                             <a href="dataRuang.jsp?ruang=restoran&tgl=<%=i%>&bln=bulan2&act=ada"><input type="button" value="pesan"/></a>
                         </td>
                                
                                <%
                                i++;
                                k++;
                                if(i>31)
                                    break;
                            }
                            %><tr><%
                        }
                        %>
                    </table>  
                    
                    
                    
                    
                    <center><b><h1 style="background-color:#69F">Update Sisa Kamar Kosong<HR></h1></b></center>
        <h3>bulan sekarang</h3>
 
                    <table border="1">
                        <%
                        java.sql.ResultSet resultKamar= statement.executeQuery("select * from jadwalpemakaiankamar");
                        String dataKamarvip[]=new String[31];
                        String dataKamar2vip[]=new String[31];
                        String dataKamarregular[]=new String[31];
                        String dataKamar2regular[]=new String[31];
                        String dataKamarvvip[]=new String[31];
                        String dataKamar2vvip[]=new String[31];
                        j=0;
                        while(resultKamar.next()){
                            dataKamarvip[j]=resultKamar.getString("bulan1_vip");
                            dataKamar2vip[j]=resultKamar.getString("bulan2_vip");
                            dataKamarregular[j]=resultKamar.getString("bulan1_reguler");
                            dataKamar2regular[j]=resultKamar.getString("bulan2_reguler");
                            dataKamarvvip[j]=resultKamar.getString("bulan1_vvip");
                            dataKamar2vvip[j]=resultKamar.getString("bulan2_vvip");
                           j++;
                        }
                        
                        i=1;
                        while(i<32){
                            %><tr><%
                            int k=1;
                            while(k>=1 &&k<=7){ %>
                            
                            <td><%=i%><br>
                             REGULAR kosong : <%=dataKamarregular[i-1]%><br>
                             <a href="dataRuang.jsp?ruang=kamar&tgl=<%=i%>&bln=bulan1_reguler"><input type="button" value="update"/></a><br>
                             VIP kosong : <%=dataKamarvip[i-1]%><br>
                             <a href="dataRuang.jsp?ruang=kamar&tgl=<%=i%>&bln=bulan1_vip"><input type="button" value="update"/></a><br>
                             VVIP kosong : <%=dataKamarvvip[i-1]%><br>
                             <a href="dataRuang.jsp?ruang=kamar&tgl=<%=i%>&bln=bulan1_vvip"><input type="button" value="update"/></a>
                            </td>
                                
                                <%
                                i++;
                                k++;
                                if(i>31)
                                    break;
                            }
                            %><tr><%
                        }
                        %>
                    </table><br><br>
                    
                    
                    
                    <h3>bulan selanjutnya</h3>
                 <table border="1">
                        <%
                        i=1;
                        while(i<32){
                            %><tr><%
                            int k=1;
                            while(k>=1 &&k<=7){
                                %>
                            
                            <td><%=i%><br>
                             REGULAR kosong : <%=dataKamar2regular[i-1]%><br>
                             <a href="dataRuang.jsp?ruang=kamar&tgl=<%=i%>&bln=bulan2_reguler"><input type="button" value="update"/></a><br>
                             VIP kosong : <%=dataKamar2vip[i-1]%><br>
                             <a href="dataRuang.jsp?ruang=kamar&tgl=<%=i%>&bln=bulan2_vip"><input type="button" value="update"/></a><br>
                             VVIP kosong : <%=dataKamar2vvip[i-1]%><br>
                             <a href="dataRuang.jsp?ruang=kamar&tgl=<%=i%>&bln=bulan2_vvip"><input type="button" value="update"/></a>
                            </td>
                                
                                <%
                                i++;
                                k++;
                                if(i>31)
                                    break;
                            }
                            %><tr><%
                        }
                        %>
                    </table>  
                    
                    
                    
                    
                    <%
                                        String msg = request.getParameter("msg");//menampilkan feedback jika user melakukan kesalahan
                                        if (msg != null) {
                                            JOptionPane.showMessageDialog(null, msg);
                                        }%>
                </td>
            </tr>
        </table>

</body>
</html>